home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / database / ge302.zip / SETUP.MST < prev    next >
Text File  |  1995-10-16  |  7KB  |  211 lines

  1. '$DEFINE DEBUG  ''Define for script development/debugging
  2.  
  3. '$INCLUDE 'setupapi.inc'
  4. '$INCLUDE 'msdetect.inc'
  5.  
  6. '' This lets us add progman items
  7.  
  8. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  9. DECLARE FUNCTION UpdateAutoExec LIB "Setup.dll" (PATH$) AS INTEGER
  10. DECLARE FUNCTION IsGroupEaseRunning LIB "Setup.dll" AS INTEGER
  11.  
  12. ''Dialog ID's
  13. CONST ASKQUIT       = 200
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST EXITSUCCESSRB = 701
  19. CONST APPHELP       = 900
  20. CONST MODELESS      = 5000
  21. CONST BADPATH       = 6400
  22.  
  23.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  24.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  25.  
  26.     '' Display the logo bitmap
  27.     SetBitmap CUIDLL$, 1
  28.  
  29.     '' read the .INF file
  30.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  31.     ReadInfFile szInf$
  32.  
  33.     '' Make sure the GroupEase is not running first 
  34.     i%=IsGroupEaseRunning()
  35.     IF i% <> 0 THEN
  36.       i% = DoMsgBox ("GroupEase must not be running during Setup.  Please exit GroupEase then restart Setup.", "Setup", 0)
  37.       END
  38.     END IF
  39.  
  40.     '' query user for location to install to
  41.     DEST$="c:\ge"   ''default destination
  42.  
  43. GETPATH:
  44.     SetSymbolValue "EditTextIn", DEST$
  45.     SetSymbolValue "EditFocus", "END"
  46. GETPATHL1:
  47.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  48.     DEST$ = GetSymbolValue("EditTextOut")
  49.  
  50.     IF sz$ = "CONTINUE" THEN
  51.         IF IsDirWritable(DEST$) = 0 THEN
  52.             GOSUB BADPATH
  53.             GOTO GETPATHL1
  54.         END IF
  55.         UIPop 1
  56.     ELSEIF sz$ = "REACTIVATE" THEN
  57.         GOTO GETPATHL1
  58.     ELSEIF sz$ = "BACK" THEN
  59.         GOTO GETPATHL1
  60.     ELSE
  61.         GOSUB ASKQUIT
  62.         GOTO GETPATH
  63.     END IF
  64.  
  65.  
  66.  
  67.     '' specify which files from .INF file should get copied
  68.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  69.  
  70.     '' Get the application GroupEase and associated stuff
  71.     AddSectionFilesToCopyList "GroupEase", SrcDir$, DEST$
  72.  
  73.     '' Make sure there is available disk space
  74.     '' First param is just left as "extra", because we are not
  75.     '' expanding any existing files (i.e. adding a K or two to the 
  76.     '' WIN.INI file. If you use this, add an "Extra" symbol to
  77.     '' the symbol table created by AddListitem.
  78.     '' Second Parameter identifies a symbol table that the
  79.     '' GetCopyListCost function will create for how much space
  80.     '' is used by the files to be copied to hard disk.
  81.     '' Third Parameter identifies a symbol table that the
  82.     '' GetCopyListCost function will create to identify needed
  83.     '' disk space.
  84.  
  85.     lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
  86.  
  87.     IF lRetVal& > 0 THEN
  88.       i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
  89.       ClearCopyList
  90.       GOTO GETPATH '' Try another directory
  91.     END IF
  92.  
  93.     AddToBillboardList CUIDLL$, MODELESS, "FModelessDlgProc", 1
  94.  
  95.     SetCopyGaugePosition 100, 100
  96.  
  97.     '' copy the files
  98.     CopyFilesInCopyList
  99.  
  100.     '' Get the .INI files
  101.     AddSectionFilesToCopyList "INIs", SrcDir$, GetWindowsDir()
  102.     SetCopyGaugePosition 100, 100
  103.     CopyFilesInCopyList
  104.  
  105.     '' create a progman group
  106.     CreateProgmanGroup "Ethosoft", "", cmoNone
  107.     ShowProgmanGroup  "Ethosoft", 1, cmoNone
  108.     CreateProgmanItem "Ethosoft", "GroupEase", MakePath(DEST$,"ge.exe"), "", cmoOverwrite
  109.     CreateProgmanItem "Ethosoft", "CardData Converter", MakePath(DEST$,"cdfconv.exe"), "", cmoOverwrite
  110.     CreateProgmanItem "Ethosoft", "UserName Mapper", MakePath(DEST$,"usrname.exe"), "", cmoOverwrite
  111.     CreateProgmanItem "Ethosoft", "Read Me", MakePath(DEST$,"readme.wri"), "", cmoOverwrite
  112.  
  113.     '' add the Sounds to the WIN.INI section
  114.     CreateIniKeyValue "WIN.INI", "Sounds", "GroupEaseRing", MakePath(DEST$,"GERING.WAV,GroupEase Ring"), cmoNone
  115.     CreateIniKeyValue "WIN.INI", "Sounds", "GroupEaseAlarm", MakePath(DEST$,"GEALRM.WAV,GroupEase Alarm"), cmoNone
  116.  
  117.     '' Create the subdirectories for Local-Only usage
  118.     CreateDir GetWindowsDir()+"ge\local\genamesp", cmoNone
  119.     CreateDir GetWindowsDir()+"ge\local\ioboard", cmoNone
  120.     CreateDir GetWindowsDir()+"ge\local\genotes", cmoNone
  121.     CreateDir GetWindowsDir()+"ge\local\phone", cmoNone
  122.  
  123.     '' Create the subdirectories for Mobile usage
  124.     CreateDir GetWindowsDir()+"ge\mobile\genamesp", cmoNone
  125.     CreateDir GetWindowsDir()+"ge\mobile\carddata", cmoNone
  126.     CreateDir GetWindowsDir()+"ge\mobile\gesched", cmoNone
  127.     CreateDir GetWindowsDir()+"ge\mobile\genotes", cmoNone
  128.     CreateDir GetWindowsDir()+"ge\mobile\phone", cmoNone
  129.  
  130.     '' add our directory to the path if it is not already there
  131.     '' note: return values:
  132.     '' < 0 means error trying
  133.     '' = 0 means path added to autoexec.bat
  134.     '' > 0 means path already had ours in it
  135.     i%=UpdateAutoExec(DEST$)
  136.     IF i% < 0 THEN
  137.       ERR=i%
  138.     ENDIF
  139.  
  140. QUIT:
  141.     ON ERROR GOTO ERRQUIT
  142.  
  143.     IF ERR = 0 THEN
  144.         IF i% = 0 THEN
  145.           dlg% = EXITSUCCESSRB
  146.         ELSE
  147.           dlg% = EXITSUCCESS
  148.         ENDIF
  149.     ELSEIF ERR = STFQUIT THEN
  150.         dlg% = EXITQUIT
  151.     ELSE
  152.         dlg% = EXITFAILURE
  153.     END IF
  154. QUITL1:
  155.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  156.     IF sz$ = "REACTIVATE" THEN
  157.         GOTO QUITL1
  158.     END IF
  159.     UIPop 1
  160.  
  161.     END
  162.  
  163. ERRQUIT:
  164.     i% = DoMsgBox("Setup sources were corrupted, call Ethosoft customer support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  165.     END
  166.  
  167. BADPATH:
  168.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  169.     IF sz$ = "REACTIVATE" THEN
  170.         GOTO BADPATH
  171.     END IF
  172.     UIPop 1
  173.     RETURN
  174.  
  175. ASKQUIT:
  176.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  177.  
  178.     IF sz$ = "EXIT" THEN
  179.         UIPopAll
  180.         ERROR STFQUIT
  181.     ELSEIF sz$ = "REACTIVATE" THEN
  182.         GOTO ASKQUIT
  183.     ELSE
  184.         UIPop 1
  185.     END IF
  186.     RETURN
  187.  
  188. '*************************************************************************
  189. '**
  190. '** Purpose:
  191. '**     Appends a file name to the end of a directory path,
  192. '**     inserting a backslash character as needed.
  193. '** Arguments:
  194. '**     szDir$  - full directory path (with optional ending "\")
  195. '**     szFile$ - filename to append to directory
  196. '** Returns:
  197. '**     Resulting fully qualified path name.
  198. '*************************************************************************
  199. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  200.     IF szDir$ = "" THEN
  201.         MakePath = szFile$
  202.     ELSEIF szFile$ = "" THEN
  203.         MakePath = szDir$
  204.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  205.         MakePath = szDir$ + szFile$
  206.     ELSE
  207.         MakePath = szDir$ + "\" + szFile$
  208.     END IF
  209. END FUNCTION
  210.  
  211.